from __future__ import annotations

import json
import re
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union

__all__ = ["register_function"]

_FUNCTIONS_REGISTRY = {}


def register_function(
        *args: Any,
        title: str = "",
        name: str = "",
        description: str = "",
        return_direct: bool = False
):
    def decorator(func):
        if name:
            func.__name__ = name
        _FUNCTIONS_REGISTRY[func.__name__] = {'function': func}
        return func

    return decorator


def get_function(name):
    return _FUNCTIONS_REGISTRY.get(name).get('function')
